<?php

namespace model;

class Date {
    private $months=array();
    public function __construct($year) {
        $this->months[1]=new Month("Styczeń",31);
        ($year%4==0)? $this->months[2]=new Month("Luty",29):$this->months[2]=new Month("Luty",28);
        $this->months[3]=new Month("Marzec",31);
        $this->months[4]=new Month("Kwiecień",30);
        $this->months[5]=new Month("Maj",31);
        $this->months[6]=new Month("Czerwiec",30);
        $this->months[7]=new Month("Lipiec",31);
        $this->months[8]=new Month("Sierpień",31);
        $this->months[9]=new Month("Wrzesień",30);
        $this->months[10]=new Month("Październik",31);
        $this->months[11]=new Month("Listopad",30);
        $this->months[12]=new Month("Grudzień",31);
    }
    public function getMonth($month){
        $number = intval($month)%13;
        return $this->months[$number];
    }
    public function getMonths(){
       return $this->months;
    }
}
